//
//  ViewUtil.m
//  九个头条
//
//  Created by HZ on 14-7-15.
//  Copyright (c) 2014年 cn.huiz. All rights reserved.
//

#import "ViewUtil.h"

@implementation ViewUtil

+ (UIViewController *)topViewController
{
    UIViewController *rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
    UIViewController *topViewController = rootViewController;
    while (topViewController.presentedViewController) {
        topViewController = topViewController.presentedViewController;
    }
    return topViewController;
}


+(void)alertWithTitle:(NSString *)title message:(NSString*)message cancelButtonTitle:(NSString *)cancelButtonTitle {
    [[[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:cancelButtonTitle otherButtonTitles:nil, nil] show];
}

+(void)alertWithTitle:(NSString *)title cancelButtonTitle:(NSString *)cancelButtonTitle {
    [[[UIAlertView alloc] initWithTitle:title message:nil delegate:nil cancelButtonTitle:cancelButtonTitle otherButtonTitles:nil, nil] show];
}

+(void)alertWithMessage:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle {
        [[[UIAlertView alloc] initWithTitle:nil message:message delegate:nil cancelButtonTitle:cancelButtonTitle otherButtonTitles:nil, nil] show];
}


@end
